﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lambda;

namespace Lambda
{
    public static class Numerals
    {
        
        public static Func<dynamic, dynamic> zero = new Func<dynamic, dynamic>(n => n(Combinators.K(Booleans.F))(Booleans.T));
        public static Func<dynamic, Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>>> plus = new Func<dynamic, Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>>>(m => n => f => x => m(f)(n(f)(x)));
        public static Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>> mul = new Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>>(m => n => f => n(m(f)));
        public static Func<dynamic, Func<dynamic, dynamic>> exp = new Func<dynamic, Func<dynamic, dynamic>>(m => n => n(m));
        public static Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>> pred = 
            new Func<dynamic, Func<dynamic, Func<dynamic, dynamic>>>
                (n => f => x => n(new Func<dynamic, Func<dynamic, dynamic>>(a => b => b(a(f))))(Combinators.K(x))(Combinators.I));
         
    }
}
